package br.edu.ufcg.dsc.actions.unit;

import java.util.List;

import org.apache.struts2.config.Result;
import org.apache.struts2.dispatcher.ServletDispatcherResult;

import br.edu.ufcg.dsc.actions.BaseLoggedAction;
import br.edu.ufcg.dsc.domain.Unit;
import br.edu.ufcg.dsc.services.UnitService;

@Result(name = "success", type = ServletDispatcherResult.class, value = "/jsp/unit/unitDetails.jsp")
public class ChooseUnitAction extends BaseLoggedAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<Unit> units;
	private int id;
	
	@Override
	protected String executeIfLogged() throws Exception {
		units = UnitService.findUnitsByResource(id);
		return SUCCESS;
	}
	
	public List<Unit> getUnits() {
		return units;
	}

	public void setUnits(List<Unit> units) {
		this.units = units;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
}
